//
//  PGEssenceViewController.m
//  youqu
//
//  Created by 彭鹏 on 16/9/3.
//  Copyright © 2016年 pengpeng. All rights reserved.
//



#import "PGEssenceViewController.h"
#import "PGAllViewController.h"
#import "PGPostVideoViewController.h"
#import "PGPostVoiceViewController.h"
#import "PGPostPictureViewController.h"
#import "PGTextViewController.h"



@interface PGEssenceViewController ()

@end

@implementation PGEssenceViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    //初始化BarButtonItem
    
    [self initBarButtonItem];
    
        //添加自控制器
    [self addChildController];
    
//    //创建内容的view
//    [self setupContentView];
//    
//    //创建collectionView
//    [self setUpCollectionView];
//    
//    //创建标题titleView
//    [self setUpTitleView];
    
    
}


#pragma mark -添加子控制器
- (void)addChildController {
    //添加全部控制器
    PGAllViewController *all = [[PGAllViewController alloc] init];
    all.title = @"全部";
//    all.view.backgroundColor = [UIColor brownColor];
    [self addChildViewController:all];
    
    //添加视频控制器
    PGPostVideoViewController *video = [[PGPostVideoViewController alloc] init];
    video.title = @"视频";
//    video.view.backgroundColor = [UIColor redColor];
    [self addChildViewController:video];
    
    //添加声音控制器
    PGPostVoiceViewController *voice = [[PGPostVoiceViewController alloc] init];
    voice.title = @"声音";
//    voice.view.backgroundColor = [UIColor greenColor];
    [self addChildViewController:voice];
    
    //添加图片全部控制器
    PGPostPictureViewController *picture = [[PGPostPictureViewController alloc] init];
    picture.title = @"图片";
//    picture.view.backgroundColor = [UIColor grayColor];
    [self addChildViewController:picture];
    
    //添加段子控制器
    PGTextViewController *text = [[PGTextViewController alloc] init];
    text.title = @"段子";
//    text.view.backgroundColor = [UIColor purpleColor];
    [self addChildViewController:text];
}




//初始化BarButtonItem
- (void)initBarButtonItem {
    //leftBarButtonItem
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem barButtonItemWithImageNamed:@"nav_item_game_iconN" imageHighlighted:@"nav_item_game_iconN" target:self action:@selector(gameButtonClick)];
    
    //rightBarButtonItem
    self.navigationItem.rightBarButtonItem = [UIBarButtonItem barButtonItemWithImageNamed:@"navigationButtonRandom" imageHighlighted:@"navigationButtonRandomClick" target:self action:@selector(randomButtonClick)];
    
    //titleView
    self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"MainTitle"]];

}


- (void)gameButtonClick {
    UIViewController *gameViewController = [[UIViewController alloc] init];
    gameViewController.view.backgroundColor = [UIColor yellowColor];
//    gameViewController.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:gameViewController animated:YES];
}

- (void)randomButtonClick {
    UIViewController *randomViewController = [[UIViewController alloc] init];
    randomViewController.view.backgroundColor = [UIColor yellowColor];
//    randomViewController.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:randomViewController animated:YES];
}

@end
